<%@page import="com.xhd.Dao.SalerDaoImpl"%>
<%@page import="com.xhd.Dao.SalerDao"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.xhd.vo.Tuijian"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<link href="css/Tuijian.css" rel="stylesheet" type="text/css">
<script>
window.onload=function(){
	var btn_1=document.getElementById("btn_1");
	var btn_2=document.getElementById("btn_2");
	var close=document.getElementsByClassName("close");
	var close_1=document.getElementsByClassName("close_1");
	var dialog=document.getElementsByClassName("dialog");
	var form_1=document.getElementsByClassName("form_1");
	btn_1.addEventListener('click',function(){
		form_1[0].className="form_1 open";	
	})
	close[0].addEventListener('click',function(){
		form_1[0].className="form_1";
	})
	btn_2.addEventListener('click',function(){
		dialog[0].style.visibility='visible';
	})
	close_1[0].addEventListener('click',function(){
		dialog[0].style.visibility='hidden';
	})	
}

</script>
</head>
<style>
table{
    width: 100%;
    border-collapse: collapse;
}

table caption{
    font-size: 2em;
    font-weight: bold;
    margin: 1em 0;
}

th,td{
    border: 1px solid #999;
    text-align: center;
    padding: 20px 0;
}

table thead tr{
    background-color: #008c8c;
    color: #fff;
}

table tbody tr:nth-child(odd){
    background-color: #eee;
}

table tbody tr:hover{
    background-color: #ccc;
}

table tbody tr td:first-child{
    color: #f40;
}

table tfoot tr td{
    text-align: right;
    padding-right: 20px;
}

 </style>
<body>
<div class="main">
<button id="btn_1">点击输入推荐水果</button><br><br><br>
<form action="Tuijian2.jsp" id=tom method="post" >
 	输入水果名或月份查找<br>
 	<input type="text"  id=tom name="mess">	
 	<input type="submit"  id=tom  name="submit" value="按水果名查询">
 	<input type="submit"  id=tom  name="submit" value="按月份查询">
 </form>

<tr>
<div class="form_1">
<form action="ChoujiangServlet?method=addTuijian" method="post">
	<div class="input_1"><div class="login_logo">今日推荐水果</div><div class="close">X</div></div>
	<div class="input_1">水果名：<input type="text" name="TJfruit" ></div>
	<div class="select-box">推荐最好食用月份：
                <select name="yuefen" >
     <option value="1月" name="yiyue">1月</option>
     <option value="2月" name="eryue">2月</option>
     <option value="3月" name="sanyue">3月</option>
     <option value="4月" name="siyue">4月</option>
     <option value="5月" name="wuyue">5月</option>
     <option value="6月" name="liuyue">6月</option>
     <option value="7月" name="qiyue">7月</option>
     <option value="8月" name="bayue">8月</option>
     <option value="9月" name="jiuyue">9月</option>
     <option value="10月" name="shiyue">10月</option>
     <option value="11月" name="shiyiyue">11月</option>
     <option value="12月" name="shieryue">12月</option>
    </select>
            </div>
            <div>推荐理由：<input  type="text" name="tjly" ></div>
	<div class="input_1"><input class="submit_1" type="submit" value="确&nbsp;定"></div>		
	
</div>	
<table border="1px">
			<tr class="even">
				<th class="even">推荐水果</th>
				<th>推荐月份</th>
				<th>推荐理由</th>
				<th class="odd">删除操作</th>
			</tr>
<%
	SalerDao sd = new SalerDaoImpl();
	List<Tuijian> tuijianlist=sd.showTuijian();
	Iterator<Tuijian> TIter=tuijianlist.iterator();
	Tuijian tuijian = null;
	while(TIter.hasNext()) {
		tuijian = TIter.next();
		%>
			<tr>
				<td><%=tuijian.getTuijian() %></td>
				<td><%=tuijian.getYuefen()  %></td>
				<td><%=tuijian.getTjly() %></td>
				<td><a href="<%=request.getContextPath()%>/ChoujiangServlet?tuijian=<%=tuijian.getTuijian()%>&method=delTuijian">确定</a>&nbsp;
			</tr>
		<%
		
	}
%>
</table>

</div>	
</form>
</body>
</html>